import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/public/login'),
    hidden: true
  },
  {
    path: '/detail',
    component: () => import('@/views/public/detail'),
    meta: {
      title: '摘要',
      serve: true
    },
    hidden: true
  },

  {
    path: '/docking',
    name: '检索',
    component: () => import('@/views/public/docking'),
    meta: { title: '检索', serve: true },
    hidden: true
  },
  // {
  //   path: '/dataShow/newList',
  //   name: '数据统计',
  //   component: () => import('@/views/administrators/dataShow/newsList.vue'),
  //   meta: { title: '数据统计', serve: true },
  //   hidden: true
  // },

  {
    path: '/power',
    component: () => import('@/views/public/power'),
    meta: {
      title: '权利要求', serve: true
    },
    hidden: true
  },
  {
    path: '/instructions',
    component: () => import('@/views/public/instructions'),
    meta: {
      title: '说明书', serve: true
    },
    hidden: true
  },
  {
    path: '/drawings',
    component: () => import('@/views/public/drawings'),
    meta: {
      title: '附图', serve: true
    },
    hidden: true
  },
  {
    path: '/fullText',
    component: () => import('@/views/public/fullText'),
    meta: {
      title: '全文', serve: true
    },
    hidden: true
  },
  {
    path: '/law',
    name: "connection-list",
    component: () => import('@/views/public/law'),
    meta: {
      title: '法律信息',
      keepAlive: true, serve: true
    },
    hidden: true
  },
  {
    path: '/kindred',
    component: () => import('@/views/public/kindred'),
    meta: {
      title: '同族信息', serve: true
    },
    hidden: true
  },
  {
    path: '/web/news',
    component: () => import('@/views/public/web/news'),
  },
  {
    path: '/web/activities',
    component: () => import('@/views/public/web/activities'),
  },
  {
    path: '/web/engineering',
    component: () => import('@/views/public/web/engineering'),
  },
  {
    path: '/web/protection',
    component: () => import('@/views/public/web/protection'),
  },
  {
    path: '/web/manufacturing',
    component: () => import('@/views/public/web/manufacturing'),
  },
  {
    path: '/web/honor',
    component: () => import('@/views/public/web/honor'),
  },
  {
    path: '/web/facturing/details',
    component: () => import('@/views/public/web/facturingDetails'),
  },
  {
    path: '/web/engineering/details',
    component: () => import('@/views/public/web/engineeringDetails'),
  },
  {
    path: '/web/protection/details',
    component: () => import('@/views/public/web/protectionDetails'),
  },
  {
    path: '/web/news/details',
    component: () => import('@/views/public/web/newsDetails'),
  },
  {
    path: '/web/activities/details',
    component: () => import('@/views/public/web/activitiesDetails'),
  },
  {
    path: '/web/services/central',
    component: () => import('@/views/public/web/activity'),
  },
  {
    path: '/web/services/dynamic',
    component: () => import('@/views/public/web/dynamic'),
  },
  {
    path: '/web/services/InnovationStory',
    component: () => import('@/views/public/web/InnovationStory'),
  },
  {
    path: '/web/services/introduce',
    component: () => import('@/views/public/web/introduce'),
  },
  {
    path: '/web/central/details',
    component: () => import('@/views/public/web/activityDetails'),
  },
  {
    path: '/web/finance',
    component: () => import('@/views/public/web/finance'),
  },
  {
    path: '/web/enterprise',
    component: () => import('@/views/public/web/enterprise'),
  },
  {
    path: '/web/enterprise/leader',
    component: () => import('@/views/public/web/leader'),
  },
  {
    path: '/web/leader/details',
    component: () => import('@/views/public/web/leaderDetails'),
  },
  {
    path: '/web/overseas/warning',
    component: () => import('@/views/public/web/overseasWarning'),
  },
  {
    path: '/web/home',
    component: () => import('@/views/public/web/home'),
  },
  {
    path: '/web/index',
    component: () => import('@/views/public/web/Newhome'),
  },
  {
    path: '/web/askAbout',
    component: () => import('@/views/public/web/askAbout'),
  },
  {
    path: '/web/seniorSearch',
    component: () => import('@/views/public/web/seniorSearch'),
  },
  {
    path: '/web/manage',
    component: () => import('@/views/public/web/Administration'),
  },
  // {
  //   path: '/web/manageNew',
  //   component: () => import('@/views/public/web/AdministrationNew'),
  // },
  {
    path: '/web/guanjia',
    component: () => import('@/views/public/web/housekeeper'),
  },
  {
    path: '/web/overseas/assistance',
    component: () => import('@/views/public/web/assistance'),
  },
  {
    path: '/web/overseas/association',
    component: () => import('@/views/public/web/association'),
  },
  {
    path: '/web/search',
    component: () => import('@/views/public/web/docking'),
  },
  {
    path: '/web/search/list',
    component: () => import('@/views/public/web/searchDetail'),
  },
  {
    path: '/web/search/list',
    component: () => import('@/views/public/web/searchDetail'),
  },
  {
    path: '/assistance/details',
    component: () => import('@/views/public/web/assistanceDetails'),
  },
  {
    path: '/association/details',
    component: () => import('@/views/public/web/associationDetails'),
  },
  {
    path: '/web/policies',
    component: () => import('@/views/public/web/policies'),
  },

  {
    path: '/web/dialogue',
    component: () => import('@/views/public/web/dialogue'),
  },

  {
    path: '/web/patentaward',
    component: () => import('@/views/public/web/patentaward'),
  },

  {
    path: '/web/policies/details',
    component: () => import('@/views/public/web/policiesDetails'),
  },

  {
    path: '/web/policy/details',
    component: () => import('@/views/public/web/policyDetails'),
  },
  {
    path: '/web/immediately',
    component: () => import('@/views/public/web/immediatelyCheck'),
  },
  {
    path: '/web/small/login',
    component: () => import('@/views/public/web/phone/smallLogin'),
  },
  {
    path: '/web/small/Waitvisit',
    component: () => import('@/views/public/web/phone/Waitvisit'),
  },
  {
    path: '/web/small/workVisit',
    component: () => import('@/views/public/web/phone/workVisit'),
  },
  {
    path: '/web/addWaitvisit',
    component: () => import('@/views/public/web/phone/components/addWaitvisit.vue'),
  }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
